package com.example.administrator.managesystem.adapter.holder;

import android.content.Context;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.managesystem.R;
import com.example.administrator.managesystem.base.BaseHolder;
import com.example.administrator.managesystem.bean.ShareWikiBean;
import com.example.administrator.managesystem.bean.WikiListBean;
import com.squareup.picasso.Picasso;

public class MyShareWikiHolder extends BaseHolder<ShareWikiBean.DataBean> {
    private TextView title,content;
    private ImageView item_icon;
    private CardView cardView;
    private Context context;
    private OnItemClickListener listener;
    public interface OnItemClickListener {
        void onItemClick(int position,String wiki_id, View v);
    }
    public MyShareWikiHolder(View view, Context context, OnItemClickListener listener) {
        super(view);
        this.context=context;
        this.listener=listener;
    }

    @Override
    public void initView(View view) {
        item_icon = view.findViewById(R.id.item_icon);
        title=view.findViewById(R.id.title);
        content=view.findViewById(R.id.content);
        cardView=view.findViewById(R.id.recycler_item_cv);
    }

    @Override
    public void bindViewHolder(final ShareWikiBean.DataBean dataBean, final int position) {
        title.setText(dataBean.getTitle());
        content.setText(dataBean.getContent());
        Picasso.with(context).load(R.mipmap.dot).into(item_icon);
        Log.e("msg","dataBean.get_id()："+dataBean.getOther_id());
        cardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onItemClick(position,dataBean.getOther_id(),v);
            }
        });
    }


}
